export namespace Reg {
  //?=后断言；?!断言不是；
  //?<=零宽断言前匹配；?<!零宽断言前不是匹配
  export const moble = /^1[356789]\d{9}$/;
  export const pwdStrongReg =
    /^(?=.*[1-9])(?=.*[a-z])(?=.*[A-Z])[1-9a-zA-Z]{6,10}$/;

  export const date =
    /^[1-9]\d{3}([-/])(0?[1-9]|1[0-2])\1(0?[1-9]|[1-2][0-9]|3[0-1])$/;

  /**
   * h标签元素正则；
   * i:忽略大小写；g多个匹配
   */
  export const hEle = /<(h[1-6])>[\s\S]*?<\/\1>/gi;

  export const email = /^[\w-]+@([\w-]+\.)+(com|net|cc|cn|org)$/i;

  /**
   * 域名正则；
   * (?:)=>分组不显示
   */
  export const url = /^https?:\/\/(?:\w{3}\.)?(\w+\.)+(?:com|cn|org)$/gi;

  export const tel = /^((0[1-9]\d{1,2}-)?[1-9]\d{6,7})(-\d{1,4})?$/;
}

export const pwdValidate = (pwd: string) => {
  const regs = [/[A-Z]/, /[0-9]/, /^[a-z0-9]{5,10}$/i];
  return regs.every((reg) => reg.test(pwd));
};

const s = new RegExp("\\d+");
